package com.etv.launcher.common.utils;

import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.widget.Toast;

public class ToastUtil {
    private static Toast toast = null;

    public static void show(Context context, String tips) {
        Handler handlerThree = new Handler(Looper.getMainLooper());
        handlerThree.post(new Runnable() {
            public void run() {
                if (toast != null) {
                    toast.cancel();//注销之前显示的那条信息
                    toast = null;//这里要注意上一步相当于隐藏了信息，mtoast并没有为空，我们强制是他为空
                }
                toast = Toast.makeText(context, tips, Toast.LENGTH_LONG);
                toast.show();
            }
        });
    }
}

